
<form class="form-horizontal">

<div class="left_content">  
	<legend>จัดการข่าวสาร</legend>

	<a href="<?php echo base_url('news/admin_form');?>" class="btn btn-primary"> Add new </a>  
	<?php 
	if(!empty($news)) {

	?>


					  	<table class="table">
						 		<thead>
									<tr>
										<td> <b><font size="3">ID</font></b></td>
										<td> <b><font size="3">Image</font></b></td>
										<td ><b><font size="3">Conten</font>  </b></td>
										<td><b><font size="3">Edit & Del </font></b></td>
									</tr>
								</thead>
								<tbody >
										<?php 
										foreach ($news as $new) :  
											if($new['status']==1 AND $new['type']=='news'){
											?>

											<tr>
												<td  class="span2"><?php echo $new['id']; ?> </td>

												<?php foreach ($imgs as $img ) {  if($new['id']==$img['pos_id'] AND $img['firstimage']==1){//foreach img and if ?>

												<td><div class="imageedit2"><img src="/resource/image/<?php echo $img['filename']; ?>" /></div></td>

												<?php }} ?>

												<td><!--<a href="<?php echo base_url('news/admin_content/'.$new['url']); ?>">--><strong><?php echo $new['title']; ?><!--</a>--></strong> <br /><?php echo substr($new['content'],0,65); ?></td>
												<td class="span2">
													<a href="<?php echo base_url('news/admin_add/'.$new['id']); ?>"  class="imageedit"><img src="<?php echo $imagepath;?>/edit.png"  /></a>
													<a href="<?php echo base_url('news/admin_delete/'.$new['id']); ?>" onClick="return confirm('คุณมั่นใจว่า จะลบtagนี้จิงๆ ใช่มั้ย !');" class="imageedit"><img src="<?php echo $imagepath;?>/x.png"/></a> &nbsp; 
												</td>
											</tr>
										<?php } endforeach; ?>

								</tbody>
							</table>


	<?php  }else{ ?>

	  <br /><br />-------------Empty News-------------------  <br /><br />


	<?php } ?>
	<a href="<?php echo base_url('news/admin_form');?>" class="btn btn-primary"> Add new </a>  
</div>
</form>


